use Dosvid
go

if exists(select 1
		  from sysobjects
		  where name = 'Candidat_Expiriences')
  drop table Candidat_Expiriences
go

create table Candidat_Expiriences
(
  Id int identity(1,1) not null,
  CandidatID int not null,
  PositionID int not null,
  Years numeric(3,1) not null  
)  
go

alter table Candidat_Expiriences add constraint PK_Candidat_Expiriences_ID primary key(Id) 
go


alter table Candidat_Expiriences add constraint FK_Candidat_Expiriences_Candidates_CandidatID 
      foreign key (CandidatID) references Candidates(Id) on delete cascade
go


alter table Candidat_Expiriences add constraint FK_Candidat_Expiriences_Positions_CandidatID 
      foreign key (PositionID) references Positions(Id) on delete cascade
go


create nonclustered index IX_Candidat_Expiriences_CandidatId on Candidat_Expiriences
       (CandidatID asc)
go
